-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added sonar model checkers for EK60, EK80, ER60, AZFP6, AZFP, AD2CP and tests #1399
base: main
Are you sure you want to change the base?
Added sonar model checkers for EK60, EK80, ER60, AZFP6, AZFP, AD2CP and tests #1399
Conversation
Future releases of echopype may accommodate cases where the user is not required to provide sonar model numbers. We have here a simple checker to do that. -Added model checkers for EK60 and EK80 sonar models.
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It didn't seem appropriate to put this function in the class, at least not yet but the file did seem a good place to put this.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1399 +/- ##
==========================================
- Coverage 83.52% 80.40% -3.12%
==========================================
Files 64 18 -46
Lines 5686 3138 -2548
==========================================
- Hits 4749 2523 -2226
+ Misses 937 615 -322
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I do not have coverage because I haven't wrote the tests yet. Ill be sure to get those over ASAP. |
Added test cases for EK60 and EK80 raw parser functions to validate their identification of echosounder types through raw data alone.
The test failed because a proper path wasn't provided to them. This commit should fix that.
I forgot to import the outside-of-class functions in the __init__. Consider this fixed.
- Added notes about the potential need to remove sudo privileges for some users. - Improved tests by adding an exception handler for key errors, returning False when encountered.
Syntax error fixed.
The 'e' variable commonly used in error handling was not utilized, so I removed it. This change caused tests to fail, prompting its removal.
…#1400) Bumps [actions/cache](https://github.com/actions/cache) from 4.1.1 to 4.1.2. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@v4.1.1...v4.1.2) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…oustics#1401) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.2.0 to 5.3.0. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v5.2.0...v5.3.0) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@spacetimeengineer: is this PR ready to review? If not just ping me when you think it's ready. Thanks! |
It is! I am still navigating the CI logs and I am not sure what is failing.
…On Wed, Oct 30, 2024 at 4:51 PM Wu-Jung Lee ***@***.***> wrote:
@spacetimeengineer <https://github.com/spacetimeengineer>: is this PR
ready to review? If not just ping me when you think it's ready. Thanks!
—
Reply to this email directly, view it on GitHub
<#1399 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA26MX7EEDFZSZRK2WBC573Z6FBDJAVCNFSM6AAAAABQT5TI66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBYGM2TCNRQGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Michael Ryan,
*Engineer, Physicist(508) 617-3738 *
*linkedin.com/in/mikeryanengineer <http://linkedin.com/in/mikeryanengineer>*
*github.com/spacetimeengineer <http://github.com/spacetimeengineer>*
*stackexchange.com/users/4492334/spacetimeengineer
<http://stackexchange.com/users/4492334/spacetimeengineer>*
|
I should have said that it passes the local test but the post commit tests
hosted by github are failing.
On Wed, Oct 30, 2024 at 4:59 PM Spacetime Engineer <
***@***.***> wrote:
… It is! I am still navigating the CI logs and I am not sure what is failing.
On Wed, Oct 30, 2024 at 4:51 PM Wu-Jung Lee ***@***.***>
wrote:
> @spacetimeengineer <https://github.com/spacetimeengineer>: is this PR
> ready to review? If not just ping me when you think it's ready. Thanks!
>
> —
> Reply to this email directly, view it on GitHub
> <#1399 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AA26MX7EEDFZSZRK2WBC573Z6FBDJAVCNFSM6AAAAABQT5TI66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBYGM2TCNRQGY>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
--
Michael Ryan,
*Engineer, Physicist(508) 617-3738 *
*linkedin.com/in/mikeryanengineer
<http://linkedin.com/in/mikeryanengineer>*
*github.com/spacetimeengineer <http://github.com/spacetimeengineer>*
*stackexchange.com/users/4492334/spacetimeengineer
<http://stackexchange.com/users/4492334/spacetimeengineer>*
--
Michael Ryan,
*Engineer, Physicist(508) 617-3738 *
*linkedin.com/in/mikeryanengineer <http://linkedin.com/in/mikeryanengineer>*
*github.com/spacetimeengineer <http://github.com/spacetimeengineer>*
*stackexchange.com/users/4492334/spacetimeengineer
<http://stackexchange.com/users/4492334/spacetimeengineer>*
|
On my fork I have having these errors pop up and I don't fully understand them yet. minioci-build |
Oh I see - you can disable these builds since they will be run on the main repo (here). |
Thanks, that’s great! Let me know if there's anything else I need to do. Just a heads-up—this PR is part of a series of similar checkers for other models. I don’t think this approach will be very effective until all models are covered, and even then, I’d recommend keeping the sonar_model parameter as an option at least. Let me know if this seems a worthwhile feature. |
… file directory. For EK60 only.
Added better tests for ek80 checker functions.
Added the rest of the sonar checkers.
Added more tests for azfp and ad2cp.
Updated tests.
…remaining-sonar-models-from-raws
for more information, see https://pre-commit.ci
Sorry about that.
…github.com/spacetimeengineer/echopype into Parse-sonar-model-from-.raw-for-EK60,-EK80
for more information, see https://pre-commit.ci
More merge fixes.
I wanted to provide some context: I decided to merge a few of my branches since the code was relevant enough. I just added more sonar_model checkers and tests. |
I haven't had a chance to check the code, but from a quick glance this is fine since it is not a gigantic PR. I think it would be better to always keep the |
I agree with your perspective. My intention was not to remove the sonar model parameter, (it only helps echopype users to provide more information) but rather to explore the possibility of allowing future releases to parse the sonar model directly from the raw data. This approach could enhance the intelligence of the base parser. While it wouldn't be fully effective until all model checkers are developed, it would allow us to clarify what the sonar model is not, rather than just asserting what it is. I figured if the user makes a mistake providing the sonar_model then the more intelligent base parser could provide a warning and ask the user if they want to process with the true parsed sonar_model value or some kind of override. |
Need to import these functions.
Docker image on Docker hub. | ||
Docker image on Docker hub. There’s no need to pull directly from Docker Hub, as the scripts below will handle that for you. For Linux Users: If you run into an issue where accessing the Docker daemon requires sudo privileges, which may not suit your environment, you can adjust your settings to allow non-root access to Docker: | ||
|
||
```shell | ||
sudo groupadd docker | ||
``` | ||
|
||
Add the current user to the Docker group | ||
```shell | ||
sudo gpasswd -a $USER docker | ||
``` | ||
|
||
Restart the docker daemon | ||
```shell | ||
sudo service docker restart | ||
``` | ||
|
||
You might also need to restart your computer if the steps above don't resolve the issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move this to a new PR since it's under a completely different topic? I think there we could update the contributing guide from you and others as you're fresh from setting up a dev environment and may want to add other details. Thanks!
with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: | ||
config_datagram = fid.read(1) | ||
config_datagram["timestamp"] = np.datetime64( | ||
config_datagram["timestamp"].replace(tzinfo=None), "[ns]" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why you are accessing the timestamp here.
See Gavin's #494 (comment) that I think would be useful here to check the format without using the full blown parser. Implementing that into the checker would address #494 too in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spacetimeengineer : Thanks for the PR! I added some inline comments above, and have a few structural comments below:
I think the sonar model checking code should be in a separate module (say convert/sonar_model_checker.py
), specified in core.py
like the parser and set_group functions, and called in open_raw
to check the matches between user-specified sonar_model
type and the actual file content. The checks can happen right after the _check_file
call that checks file existence and before the parser
is called to parse the full data file. This way the functions will be easier to maintain since they don't get wrapped in the parser child classes but with different method names.
Similarly, I think the tests for these checker functions can be in a different module tests/convert/test_sonar_model_checker.py
, to keep these tests isolated from the actual parsing of data file content.
The is_{SONAR_MODEL}
functions you added are of 2 types:
- One checks for just the file extension name:
is_AD2CP
,is_AZFP6
-- this check already exists in functionsvalidate_ext
andvalidate_azfp_ext
incore.py
. - One takes a peek "under the hood" to see if the data actually fits the expected config format:
is_AZFP
,is_EK60
,is_ER60
,is_EK80
-- we need these. Note that the older Simrad format was also used for many other echosounder models, not just EK60 and ER60. The same for the newer Simrad format. We can improve what's incore.py
so that the same blocks using the same parser/setgrouper don't need to be repeated.I'll write a small issue for that -- we just need a mechanism to select the right key in the main-- in fact, this is just sonar_model handling, grouping #995.SONAR_MODELS
dict.
For paths to test files, please use fixtures:
echopype/echopype/tests/conftest.py
Lines 15 to 16 in 2813a25
@pytest.fixture(scope="session") | |
def test_path(): |
This will make maintenance and upcoming migration of the testing infrastructure smoother.
@leewujung Acknowledged. Ill begin putting in these changes. |
Future releases of echopype may accommodate cases where the user is not required to provide sonar model numbers. We have here a simple checker to do that.
-Added model checkers for EK60 and EK80 sonar models.